<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加商品</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-4">
    <h1>添加商品</h1>
    
    <form th:action="@{/products/add}" th:object="${product}" method="post">
        <div class="mb-3">
            <label for="name" class="form-label">商品名称</label>
            <input type="text" class="form-control" id="name" th:field="*{name}" required>
        </div>
        
        <div class="mb-3">
            <label for="price" class="form-label">价格</label>
            <input type="number" step="0.01" class="form-control" id="price" th:field="*{price}" required>
        </div>
        
        <div class="mb-3">
            <label for="stock" class="form-label">库存</label>
            <input type="number" class="form-control" id="stock" th:field="*{stock}" required>
        </div>
        
        <div class="mb-3">
            <label for="description" class="form-label">描述</label>
            <textarea class="form-control" id="description" th:field="*{description}" rows="3"></textarea>
        </div>
        
        <button type="submit" class="btn btn-primary">添加</button>
        <a th:href="@{/products}" class="btn btn-secondary">取消</a>
    </form>
</div>
</body>
</html>